package org.coderk.mybatis.service;

import org.springframework.aop.framework.AopContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @description:
 * @author: TanJingyu
 * @create: 2021-03-23 23:41
 **/
@Service
public class MybatisService {
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private MybatisService mybatisService;

    @Autowired
    public MybatisService(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }

    public MybatisService() {}

    @Transactional
    public void string() {
        jdbcTemplate.update("update user set name = '王吉' where id = 1");
        mybatisService.run();
    }

    public void run() {
        System.out.println("run方法。。。。。");
    }
}
